package com.tanhua.server.controller;

import com.tanhua.domain.vo.*;
import com.tanhua.server.service.SoulService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/testSoul")
public class SoulController {
    @Autowired
    private SoulService soulService;

    @GetMapping
    public ResponseEntity getTestSoul() {
        List<SoulQuestionnaireVo> soulQuestionnaireVos = soulService.getTestSoul();
        System.out.println(soulQuestionnaireVos);
        return ResponseEntity.ok(soulQuestionnaireVos);
    }

    @PostMapping
    public ResponseEntity postTestSoul(@RequestBody AnswersVo answers) {
        String reportId = soulService.postTestSoul(answers);

        return ResponseEntity.ok(reportId);
    }

    @GetMapping("/report/{soulId}")
    public ResponseEntity sedReport(@PathVariable String soulId) {
        ReportVo reportVo = soulService.getDimensions(soulId);
/*

        ReportVo reportVo = new ReportVo();
        List<SimilarYou> similarYouList = new ArrayList<>();
        SimilarYou similarYou = new SimilarYou();
        similarYou.setAvatar("https://sztanhua.oss-cn-shenzhen.aliyuncs.com/avatar/man/4.jpg");
        similarYou.setId(1);
        similarYouList.add(similarYou);
        SimilarYou similarYou1 = new SimilarYou();
        similarYou1.setAvatar("https://sztanhua.oss-cn-shenzhen.aliyuncs.com/avatar/man/4.jpg");
        similarYou1.setId(2);
        similarYouList.add(similarYou1);
        SimilarYou similarYou2 = new SimilarYou();
        similarYou2.setAvatar("https://sztanhua.oss-cn-shenzhen.aliyuncs.com/avatar/man/4.jpg");
        similarYou2.setId(3);
        similarYouList.add(similarYou2);
        reportVo.setSimilarYou(similarYouList);
        List<DimensionsVo> dimensionsList = new ArrayList<>();
        *//*Map<String,String> dimensionsMap=new HashMap<>();
        dimensionsMap.put("外向型","80");
        dimensionsList.add(dimensionsMap);
        Map<String,String> dimensionsMap1=new HashMap<>();
        dimensionsMap1.put("判断型","80");
        dimensionsList.add(dimensionsMap1);
        Map<String,String> dimensionsMap2=new HashMap<>();
        dimensionsMap2.put("抽象型","80");
        dimensionsList.add(dimensionsMap2);
        Map<String,String> dimensionsMap3=new HashMap<>();
        dimensionsMap3.put("理性型","80");
        dimensionsList.add(dimensionsMap3);
        reportVo.setDimensions(dimensionsList);*//*
        DimensionsVo dimensions = new DimensionsVo();
        dimensions.setKey("理性");
        dimensions.setValue("80%");
        dimensionsList.add(dimensions);
        DimensionsVo dimensions1 = new DimensionsVo();
        dimensions1.setKey("理性");
        dimensions1.setValue("80%");
        dimensionsList.add(dimensions1);
        DimensionsVo dimensions2 = new DimensionsVo();
        dimensions2.setKey("理性");
        dimensions2.setValue("80%");
        dimensionsList.add(dimensions2);
        DimensionsVo dimensions3 = new DimensionsVo();
        dimensions3.setKey("理性");
        dimensions3.setValue("80%");
        dimensionsList.add(dimensions3);
        reportVo.setDimensions(dimensionsList);
        reportVo.setCover("https://sztanhua.oss-cn-shenzhen.aliyuncs.com/avatar/man/4.jpg");
        reportVo.setConclusion("枚举: 猫头鹰：他们的共同特质为重计划、条理、细节精准。在行为上，表现出喜欢理性思考与分析、较重视制度、结构、规范。他们注重执行游戏规则、循规蹈矩、巨细靡遗、重视品质、敬业负责。,白兔型：平易近人、敦厚可靠、避免冲突与不具批判性。在行为上，表现出不慌不忙、冷静自持的态度。他们注重稳定与中长程规划，现实生活中，常会反思自省并以和谐为中心，即使面对困境，亦能泰然自若，从容应付。,狐狸型 ：人际关系能力极强，擅长以口语表达感受而引起共鸣，很会激励并带动气氛。他们喜欢跟别人互动，重视群体的归属感，基本上是比较「人际导向」。由于他们富同理心并乐于分享，具有很好的亲和力，在服务业、销售业、传播业及公共关系等领域中，狐狸型的领导者都有很杰出的表现。,狮子型：性格为充满自信、竞争心强、主动且企图心强烈，是个有决断力的领导者。一般而言，狮子型的人胸怀大志，勇于冒险，看问题能够直指核心，并对目标全力以赴。他们在领导风格及决策上，强调权威与果断，擅长危机处理，此种性格最适合开创性与改革性的工作。");
        System.out.println(reportVo);*/
        return ResponseEntity.ok(reportVo);
    }
}
